package com.iotechn.unimall.data.dto.statistics;

import lombok.Data;

import java.io.Serializable;

/**
 * 销售额统计
 *
 * @author kyms
 * @date 2020-06-17 15:50
 */
@Data
public class SaleTargetStatisticsDTO implements Serializable {
    private Integer rate = 0;
    private Float target = 0f;
    private Float current = 0f;

    public Float getRate() {
        if (target == null || target == 0f) {
            return 0f;
        }
        Float r = Float.valueOf(Math.round((current / target) * 100)) / 100;
        return Float.valueOf(String.format("%.2f", 100 * r));
    }
}
